A motor controller that controls a motor as the drive power source of a range switching mechanism has been known. For example, two F/B control systems are provided. A first F/B control system corrects a target motor rotation angle in accordance with an amount of play in the rotation transmission mechanism, using a deviation between an output shaft rotation angle detected by an output shaft sensor and a target rotation angle of the output shaft.